﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="MYSMRM.Model" namespace="MYSMRM.Model">

  <class name="QSQuestion" table="QS_QUESTION">
    <cache usage="read-write"/>
    <id name="ID" type="int">
      <column name="I_ID" index="PK_QS_SURVEY"/>
      <generator class="identity" />
    </id>
    <property name="TopicID" type="int">
      <column name="I_TOPIC_ID" not-null="false"/>
    </property>

    <property name="Question" type="String">
      <column name="S_QUESTION" not-null="false"/>
    </property>

    <property name="Sequence" type="int">
      <column name="I_SEQUENCE" not-null="false"/>
    </property>
    
    <property name="MultiSelect" type="bool">
      <column name="B_MULTI_SELECT" not-null="false"/>
    </property>

    <property name="LastUpdater" type="String">
      <column name="S_LAST_UPDATER" not-null="false"/>
    </property>

    <property name="LastUpdateDate" type="DateTime">
      <column name="D_LAST_UPDATE_DATE" not-null="false"/>
    </property>
    <property name="Creator" type="String">
      <column name="S_CREATOR" not-null="false"/>
    </property>

    <property name="CreateDate" type="DateTime">
      <column name="D_CREATEDATE" not-null="false"/>
    </property>
    
    <!--<many-to-one name="Topic" class="MYSMRM.Model.QSTopic, MYSMRM.Model">
      <column name="I_ID"  not-null="true"/>
    </many-to-one>-->
    
    <bag name="OptionList" inverse="true" cascade="all-delete-orphan" table="QS_Option">
      <key column="I_QUESTION_ID" foreign-key="FK_QS_Option_QS_Question"/>
      <one-to-many class="MYSMRM.Model.QSOption, MYSMRM.Model" />
    </bag>
  </class>

</hibernate-mapping>